import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '@/views/login.vue'
import register from '../views/register.vue'
import layout from '../views/layout.vue'
import detail from '../views/detail.vue'

import article from '../views/article.vue'
import collect from '../views/collect.vue'
import like from '../views/like.vue'
import user from '../views/user.vue'

Vue.use(VueRouter)

const routes = [
  // 一级路由
  // 登录 /注册 /首页 /详情
  { path: '/login', component: login },
  { path: '/register', component: register },
  {
    path: '/',
    component: layout,
    children: [
      { path: '/article', component: article },
      { path: '/collect', component: collect },
      { path: '/like', component: like },
      { path: '/user', component: user }

    ]
  },
  { path: '/detail', component: detail }

]

const router = new VueRouter({
  routes
})

export default router
